<template>
  <el-card>
    <el-form :inline="true" class="demo-form-inline">
      <el-form-item label="一级分类">
        <el-select  placeholder="请选择一级分类" v-model="category1Id">
          <el-option :label="item.name" :value="item.id" v-for="item in categoryStore.category1List" :key="item.id"/>
        </el-select>
      </el-form-item>
      <el-form-item label="二级分类">
        <el-select  placeholder="请选择二级分类">
          <el-option label="Zone one" value="shanghai" />
          <el-option label="Zone two" value="beijing" />
        </el-select>
      </el-form-item>
      <el-form-item label="三级分类">
        <el-select  placeholder="请选择三级分类">
          <el-option label="Zone one" value="shanghai" />
          <el-option label="Zone two" value="beijing" />
        </el-select>
      </el-form-item>
    </el-form>
  </el-card>
</template>

<script lang="ts">
import {defineComponent} from "vue";
export default defineComponent({
    name:"Category",
})
</script>

<script lang="ts" setup>
import useCategoryList from "@/stores/category"
import {onMounted, ref} from "vue";
import {ElMessage} from "element-plus";
const categoryStore = useCategoryList()
const category1Id = ref<null>(null)
onMounted(async ()=>{
    try {
       await  categoryStore.getCategory1List()
    }catch (e:any){
        ElMessage.error(e.message)
    }
})
</script>

<style scoped>

</style>